<?php

// 获取指定多少位的随机字符串
function createRandStr($len, $chars=null)

{

if (is_null($chars)){

$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';

}


for ($i = 0, $str = '', $lc = strlen($chars)-1; $i < $len; $i++){

$str .= $chars[mt_rand(0, $lc)];

}

return $str;

}

// 加密密码方法
function checkPwd($salt = '', $pos = 0, $pwd = '123456'){
    $encryPwd = md5(substr_replace($pwd, $salt, $pos, 0));
    return $encryPwd;
}



